# -*- coding: utf-8 -*-
"""
Created on Fri Apr 16 16:17:03 2021

@author: Lenovo-pc
"""


from base_learning_algs.xgb_gbdt import xgb_gbdt
from base_learning_algs.adaboost import adaboost
from base_learning_algs.light_gbdt import light_gbdt
from deep_learning_algs.dbn_binary import dbn_binary
from deep_learning_algs.cnn_1d import cnn_1d
from deep_learning_algs.dnn import dnn
from deep_learning_algs.rnn_1d import rnn_1d
from common.get_mdp_data_v2 import get_mdp_data_v2



if __name__ =="__main__":
    numeric_path = './data2/mdp_numeric.txt'
    traits_path = './data2/mdp_Y.txt'
    mdp_data = get_mdp_data_v2(numeric_path,traits_path)
    #train_data,test_data = mdp_data.get_one_hot_x() # 有编码
    train_data,test_data = mdp_data.get_split_x()
    all_X = mdp_data.get_all_X()
    
    model_list = {"xgboost":xgb_gbdt(),"lightgbm":light_gbdt(),"adaboost":adaboost(),
                  "DBN":dbn_binary(),"CNN":cnn_1d(),"DNN":dnn(),"RNN":rnn_1d()
                  }
    
        
    for traits_flag in mdp_data.get_traits_flag():
        mdp_data.set_traits_flag(traits_flag)
        train_labels,test_labels = mdp_data.get_split_y()
        for model_name,model in model_list.items():
            print(model_name,traits_flag)
            model.train(train_data,train_labels)
            predict_X = model.predict_data(all_X)
            mdp_data.save_into_file(predict_X,model_name,traits_flag)
    # 数据保存在output文件夹下，命名方式：表型_算法名_result.txt
    print("{:*^30}".format(''))
    print("Finish：算法执行全部完毕")
    
    
            
            

